package com.lc.afbx.dialog;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.lc.afbx.BaseApplication;
import com.lc.afbx.R;

/**
 * Created by Administrator on 2016/10/27.
 */
public abstract class ChooseSexDialog extends BaseDialog {

    private String type = "男";

    public ChooseSexDialog(Context context, String title) {

        super(context);

        setContentView(R.layout.dialog_choose_sex);

        BaseApplication.ScaleScreenHelper.loadView((ViewGroup) findViewById(R.id.dialog));

        ((TextView) findViewById(R.id.alert_title_tv)).setText("选择" + title);



        View.OnClickListener listener = new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                switch (v.getId()) {

                    case R.id.alert_confirm:

                        onConfirm(type);

                        dismiss();

                        break;

                    case R.id.alert_cancel:

                        dismiss();

                        break;

                    case R.id.choose_sex_dialog_man_rl:

                        ((ImageView) findViewById(R.id.choose_sex_dialog_man_iv)).setImageResource(R.mipmap.szmrdz);
                        ((ImageView) findViewById(R.id.choose_sex_dialog_women_iv)).setImageResource(R.mipmap.lanquan);

                        type = "男";

                        break;
                    case R.id.choose_sex_dialog_women_rl:

                        ((ImageView) findViewById(R.id.choose_sex_dialog_man_iv)).setImageResource(R.mipmap.lanquan);
                        ((ImageView) findViewById(R.id.choose_sex_dialog_women_iv)).setImageResource(R.mipmap.szmrdz);

                        type = "女";

                        break;
                }


            }

        };


        findViewById(R.id.alert_cancel).setOnClickListener(listener);
        findViewById(R.id.alert_confirm).setOnClickListener(listener);
        findViewById(R.id.choose_sex_dialog_man_rl).setOnClickListener(listener);
        findViewById(R.id.choose_sex_dialog_women_rl).setOnClickListener(listener);


    }


    protected abstract void onConfirm(String string);


}